#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
struct abc
{
	int a,b;
};
abc a1[111111],a2[111111];
int i,j,n,m1,m2;
bool bz1[111111];
bool bz2[111111];
int s1=0,s2=0,ans=0;
int z1[111111],z2[111111];
int main()
{
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	scanf("%d%d%d",&n,&m1,&m2);
	for(i=1;i<=m1;i++)
	{
		scanf("%d%d",&a1[i].a,&a1[i].b);
	}
	for(i=1;i<=m2;i++)
	{
		scanf("%d%d",&a2[i].a,&a2[i].b);
	}
	i=0;
	int c1=0,c2=0,j1=1,j2=1;
	while(s1!=m1)
	{
		i++;
		if(i==m1+1)
		{
			i=1;
			c1=0;
			j1++;
			z1[j1]+=z1[j1-1];
		}
		if((a1[i].a>c1)&&(bz1[i]==false))
		{
			s1++;
			c1=a1[i].b;
			bz1[i]=true;
			z1[j1]++;
		}
	}
	i=0;
	while(s2!=m2)
	{
		i++;
		if(i==m2+1)
		{
			i=1;
			c2=0;
			j2++;
			z2[j2]+=z2[j2-1];
		}
		if((a2[i].a>c2)&&(bz2[i]==false))
		{
			s2++;
			c2=a2[i].b;
			bz2[i]=true;
			z2[j2]++;
		}
	}
	for(i=j1+1;i<=n;i++)
	{
		z1[i]=z1[i-1];
	}
	for(i=j2+1;i<=n;i++)
	{
		z2[i]=z2[i-1];
	}
	for(i=0;i<=n;i++)
	{
		if(z1[i]+z2[n-i]>ans) ans=z1[i]+z2[n-i];
	}
	printf("%d",ans);
	fclose(stdin);
	fclose(stdout);
}
